import { storage, defineStore, keys } from 'src/pinia/common';

export default defineStore('sys', {
    'state': () => ({
        'count': 1,
        'theme': 'dark',
        'isCollapse': false,
        'lang': 'zh',
        position: {
            lat: 0,
            lng: 0,
        },
        address: '',
        city: '',
    }),
    'actions': {
        theme(theme) {
            this.theme = theme;
        },
        addCount(count) {
            this.count = this.count + count;
        },
        delCount(count) {
            this.count = this.count - count;
        }
    },
    'persist': {
        'enabled': true,
        // 修改存储中使用的键名称，默认为当前 Store的 id
        'key': keys.sys,
        // 修改为 sessionStorage，默认为 localStorage
        storage
    }
});
